﻿using System.Globalization;

namespace ServiceLayerManagement
{
    public static class DataTypeExtendHelper
    {
        public static uint ToUint(this string strValue, NumberStyles numberStyles)
        {
            uint u;
            if(uint.TryParse(strValue, numberStyles, null, out u))
            {
                return u;
            }
            return uint.MaxValue;
        }
        public static double? ToDouble(this object obj)
        {
            if(obj != null)
            {
                string strValue = obj.ToString();
                double d;
                if(double.TryParse(strValue, out d))
                {
                    return d;
                }
            }
            return null;
        }
    }
}
